<?php
/**
 * Created by PhpStorm.
 * Author: huangwy
 * Date: 2018/3/13 14:47
 * Version: 1.0
 */

namespace app\admin\controller;

use think\Db;

class Index extends Base
{
    public function Index(){
        $prefix = config('database.prefix');

        //mysql信息
        $mysql = Db::query("select VERSION() as mysql");

        //日志内容分页
        $p = input('get.p') ? input('get.p') : '1';
        $t = time() - 3600 * 24 * 60;

        Db::query("delete from {$prefix}log where t<$t");//删除60天前的日志
        $pagesize = 5;#每页数量

        $count = Db::query("select count(*) as count from {$prefix}log where t<$t");

        $list = db('log')->order('id desc')->paginate($pagesize);


        $this->assign('list', $list);//日志
        $this->assign('mysql', $mysql[0]['mysql']);

        return view();
    }
}